<div class="panel panel-default panel-intro">
    {:build_heading()}

    <div class="panel-body">
        <div id="myTabContent" class="tab-content">
            <div class="tab-pane fade active in" id="one">
                <div class="widget-body no-padding">
                    <div id="toolbar" class="toolbar">
                        {:build_toolbar('refresh,add,edit,del')}
                    </div>
                    <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
                           data-operate-edit="{:$auth->check('manufacture/process/edit')}" 
                           data-operate-del="{:$auth->check('manufacture/process/del')}" 
                           width="100%">
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    var Table = $("#table").bootstrapTable({
        url: 'manufacture/process/index',
        pk: 'id',
        sortName: 'sequence',
        sortOrder: 'asc',
        search: true,
        commonSearch: true,
        columns: [
            [
                {checkbox: true},
                {field: 'id', title: __('Id'), sortable: true},
                {field: 'name', title: __('工序名称'), sortable: true},
                {field: 'sequence', title: __('工序顺序'), sortable: true},
                {field: 'description', title: __('工序描述'), sortable: true},
                {field: 'status', title: __('状态'), formatter: function(value, row, index) {
                    var statuses = {1: '启用', 0: '停用'};
                    var colors = {1: 'success', 0: 'danger'};
                    return '<span class="label label-' + colors[value] + '">' + statuses[value] + '</span>';
                }},
                {field: 'createtime', title: __('创建时间'), formatter: Table.api.formatter.datetime},
                {field: 'operate', title: __('操作'), table: Table, events: Table.api.events.operate, 
                 formatter: Table.api.formatter.operate}
            ]
        ]
    });
</script>
